<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>线上笔试答题系统</title>
	<link rel="stylesheet" href="./styles/css/common.css">
	<link rel="stylesheet" href="./styles/css/index.css">
</head>

<body class="home">
	<script src="http://rsj.beijing.gov.cn/images/rsj_header.js"></script>
	<include src="./include/header.html"></include>

	<div class="wrap">
		<div class="com-head">
			<div class="tab-wrap left">
				<img class="xb" alt="">
				<div class="xm"></div>
				<div class="sfzhm left">身份证号码:</div>
				<div class="app sfz left"></div>
				<div class="sfzhm left">电话号码:</div>
				<div class="app sjh left" style="margin-right:0"></div>
			</div>
			<img class="right" src="./styles/images/tbg.png" alt="">
		</div>
		<!-- 公用.com-nav 头部框-->
		<div class="com-nav">
			<div class="tab-wrap left">
				<span class="tabActive" data-name="2">全部</span>
				<span data-name="1">已答</span>
				<span data-name="0">未答</span>
			</div>
			<div class="search-wrap right">
				<input type="text" class="search-input" id="ss" jr_placeholder="请输入公司名、岗位名">
				<span class="search"></span>
			</div>
		</div>
		<!-- 内容区域 -->
		<div class="home-content">
			<div class="pages-con" id="detailWrap">
				<script type="text/html" id="detailTem">
					<table border="0" cellspacing="0" cellpadding="0" class="table">
						<%if(data.executeResult == 1){%>
						<% var _data = data.grwdlb%>
						<%for(var i=0;i<_data.length;i++){%>
						<% var _item = _data[i]%>
						<tr>
							<td width="3%"><span class="iconImg"></span></td>
							<td width="37%" align="left">
								<p><%=_item.dwmc%></p>
							</td>
							<td width="15%" align="left">
								<p class="gwmc" title="<%=_item.gwmc%>"><%=_item.gwmc%></p>
							</td>
							<td width="15%" align="left">
								<p>进度（<span class="num"><%=_item.ywcwds%></span>/<%=_item.gwwds%>）</p>
							</td>
							<td width="15%" align="left">
								<%if(_item.sfkydt == 1){%>
								<p>剩余<span class="num"><%=_item.syts%></span>天</p>
								<%}else if(_item.sfkydt == 0){%>
								<p>过期</p>
								<%}else{%>
								<p>---</p>
								<%}%>

							</td>
							<%if(_item.sfkydt == 1){%>
							<td width="15%" align="right" style="padding-right:0" sfkydt="<%=_item.syts%>"><span class="baseStart J_start"
									gwwhid="<%=_item.gwwhid%>">开始答题</span></td>
							<%}else if(_item.sfkydt == 0){%>
							<td width="15%" align="right" style="padding-right:0"><span class="baseStart overActive J_over">开始答题</span>
								<%}else if(_item.sfkydt ==2){%>
							<td width="15%" align="right" style="padding-right:0"><span class="baseStart overActive J_over">企业未审批</span>
								<%}else{%>
							<td width="15%" align="right" style="padding-right:0"><span class="baseStart resultActive J_result"
									gwwhid="<%=_item.gwwhid%>">查看结果</span>
								<%}%>
						</tr>
						<%}%>
								<%}%>
					</table>

				</script>
			</div>

		</div>
	</div>

	<script src="http://rsj.beijing.gov.cn/footer.js"></script>
	<script src="./common/vendor.js"></script>
	<script src="./common/common.js"></script>
	<script src="./common/generaltools.js"></script>
	<script>
		$(function () {
			var Load = new $.Loading();
		
			var pageNum = 0;
			$.showPlaceholder();
			var _name = 2;
			// tab切换
			$(document).on('click', '.tab-wrap span', function () {
				if (!$(this).hasClass('tabActive')) {
					$(this).addClass('tabActive').siblings('span').removeClass('tabActive');
					_name = $(this).data('name');
					// 做异步处理数据 只有这里记得点击切换的时候 不获取搜索框的数据
					searchCx(_name, $(".search-input").val());
				}
			});
			// 搜索框
			$(document).on("click", '.search', function () {
				var val = $(".search-input").val()
				searchCx(_name, val)
			})
			// 首页分页器
			searchCx(_name);
			

			function searchCx(ywcz, ssnr) {
				// loading.on()
				$('#detailWrap').pageTool({
					url: '/zxwmsgj/grwdlbCx',
					type: 'get',
					data: {
						pageNum: pageNum,
						pageSize: 12,
						ssnr: ssnr || "",
						ywcz: ywcz
					},
					locator: 'returnData',
					callback: function (res) {
						// loading.off();
						Load.off()
					}
				});
			}

			// 开始答题
			$(document).on('click', '.J_start', function () {
				var gwwhid = $(this).attr("gwwhid")
				window.location.href = "./dimension.html?gwwhid=" + gwwhid;
				// window.open("./qycx.html?gwwhid=" + gwwhid)
			})
			$(document).on('click', '.J_result', function () {
				var gwwhid = $(this).attr("gwwhid")
				window.open("./qycx.html?gwwhid=" + gwwhid)
			})

			function jbXXcx() {
				Load.on();
				$.fetch({
					url: "/zxwmsgj/jbxxCx",
					type: "get",
				}).done(function (res) {
					var _res = res.returnData;
					if (_res.executeResult === '1') {
						var grjbxx = _res.grjbxx;
						$(".com-head .xm").html(grjbxx.xm);
						$(".com-head .sfz").html(grjbxx.sfzhm);
						$(".com-head .sjh").html(grjbxx.sjh);
						// 男女
						function getsex(sex) {
							if (sex != null && sex != "") {
								if (parseInt(sex.substr(16, 1)) % 2 == 1) {
									sex = "男";
								} else {
									sex = "女";
								}
							}
							return sex;
						}
						if (getsex($(".com-head .sfz").html()) == "男") {
							$(".com-head .xb").attr("src", "./styles/images/n.png")
						} else {
							$(".com-head .xb").attr("src", "./styles/images/gril.png")
						}
						Load.off();
					} else {
						$.layerMsg(_res.returnData, "确定")
					}
				})
			}
			jbXXcx();
		});

	</script>
</body>

</html>
